package com.bgs.travelapp.comment.mapper;

import com.bgs.travelapp.comment.eneity.CommentEntity;
import com.bgs.travelapp.mapper.BaseMapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 前端评论功能（前端）
 * hbx 2022年8月10日11:40:20
 */
public interface CommentMapper extends BaseMapper<CommentEntity> {
    @Select("select * from comment_entity where del_flag = 0 and travels_id = #{travelsId} order by parent_id asc")
    @Results({
            @Result(property = "commentContent",column = "comment_content"),
            @Result(property = "avatarId",column = "avatar_id"),
            @Result(property = "userName",column = "user_name"),
            @Result(property = "travelsId",column = "travels_id"),
            @Result(property = "userId",column = "user_id"),
            @Result(property = "createTime",column = "create_time"),
            @Result(property = "delFlag",column = "del_flag"),
            @Result(property = "parentId",column = "parent_id"),
            @Result(property = "replyName",column = "reply_name"),
            @Result(property = "replyId",column = "reply_id"),
//            @Result(property = "travelsName",column = "travels_name"),
    })
    List<CommentEntity> getSonCommentAll(Integer travelsId);
}
